package com.minsf.springbootinit.judge.codesandbox;

import com.minsf.springbootinit.judge.codesandbox.impl.ExampleCodeSandbox;
import com.minsf.springbootinit.judge.codesandbox.impl.RemoteCodeSandbox;
import com.minsf.springbootinit.judge.codesandbox.impl.ThirdPartyCodeSandbox;

/**
 * @Description 此处使用静态工厂
 * @Author minify
 * @Date 2024/3/9 13:13
 * @Project oj-backend
 */
public class CodeSandboxFactory {

    public static CodeSandbox newInstance(String type) {
        switch (type) {
            case "example":
                return new ExampleCodeSandbox();
            case "remote":
                return new RemoteCodeSandbox();
            case "ThirdParty":
                return new ThirdPartyCodeSandbox();
            default:
                return new ExampleCodeSandbox();
        }
    }
}
